package plar.core;

import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.World;

import plar.core.Action;
import plar.core.Common;
import plar.core.Element;
import plar.core.Parameters;

public class NoGravity implements Action {

	
	public Parameters call(Parameters parameters) {
		
		String subAction = (String) parameters.get("subAction");
		if(subAction=="main")
		{
			
			Element me = (Element) parameters.get("me");
			World w = me.body.getWorld();
			Vec2 g = w.getGravity();
		
			g.x=-g.x*me.body.getMass();
			g.y=-g.y*me.body.getMass();
			//Common.info("no gravity on "+me+" con"+g);
			me.body.applyForce(g,me.body.getWorldCenter());
		}
		return null;
	}

}
